import { BasicColumn, FormSchema } from '@/components/Table';
import { h, ref } from 'vue';
import { Tag } from 'ant-design-vue';
import { ywUserSelectList } from '@/api/heng/ywManage';
import { ApiSelect } from '@/components/Form';
import util from '@/utils/util';

import { useMessage } from '@/hooks/web/useMessage';
import { VxeFormItemProps, VxeGridPropTypes } from '@/components/VxeTable';

type CheckedType = boolean | string | number;
// BasicColumn[]

// VxeColumnPropTypes.CellRender

/**
 */
export const vxeTableColumns: VxeGridPropTypes.Columns = [
  {
    title: 'modelCode',
    field: 'modelCode',
    // type: "expand",
    treeNode:true,
    width:166,
    align: 'center',
    showOverflow: 'title',
    filters: [{ data: '' }],
    filterRender: {
      name: 'VxeInput',
    },
  },
  {
    title: 'itemName',
    field: 'itemName',
    width:170,
    align: 'center',
    showOverflow: 'title',
    formatter: ({ cellValue, row, column }) => {
      let val =null;
      if(row.children){
        val = cellValue;
        // console.log("--row-children:"+ row.children.length);
      }else{
        // console.log("--row")
      }
      // if (!cellValue) {
      //   return val;
      // }

      return val;
    },
  },
  // {
  //   title: '数据分组',
  //   field: 'modelCode',
  //   align: 'center',
  //   width:50,
  //   type: "expand",
  //
  // },
  {
    title: 'initial',
    field: 'initialQuantity',
    width:90,
    showOverflow: 'title',
    align: 'center',

  },
  // {
  //   width: 230,
  //   title: '操作',
  //   align: 'center',
  //   field: '',
  //   slots: { default: 'action' },
  //   fixed: 'right',
  // },
];

export const vxeTableFormSchema: VxeFormItemProps[] = [
  // {
  //   span: 5,
  //   field: 'keyword',
  //   title: '查询',
  //   itemRender: {
  //     props: {
  //       placeholder: '查询',
  //     },
  //     name: 'AInput',
  //   },
  // },
  {
    span: 5,
    field: 'dataTypeCode',
    title: '数据来源',
    resetValue:2,
    itemRender: {
      name: 'ASelect',
      defaultValue:2,
      props: {
        style: { width: '100%' },
        options: [
          { label: '预测Forecast', value: 1 },
          { label: '需求Demand', value: 2 },
        ],
      },
    },
  },
  {
    span: 5,
    field: 'dataSchema',
    title: 'supplySchema',
    resetValue:'MTS Hengli',
    itemRender: {
      name: 'ASelect',
      defaultValue:'MTS Hengli',//MTS Hengli , MTO
      props: {
        style: { width: '100%' },
        options: [
          { label: 'MTO', value: 'MTO' },
          { label: 'MTS Hengli', value: 'MTS Hengli' },
          { label: 'MTS D', value: 'MTS D' },
        ],
      },
    },
  },
  {
    span: 5,
    itemRender: {
      name: 'VxeButtonGroup',
      options: [
        { type: 'reset', content: '重置' },
        { type: 'submit', content: '查询', status: 'primary' },
      ],
    },
  },
];




export const itemColumns: VxeGridPropTypes.Columns = [
  {
    title: '订单标识号',
    field: 'biaoShiHao',
    showOverflow: 'title',
    filters: [{ data: '' }],
    filterRender: {
      name: 'VxeInput',
    },
    align: 'center',
  },
  {
    title: 'ms物料编号',
    field: 'mtid',
    align: 'center',
  },
  {
    title: 'modelCode',
    field: 'modelCode',
    filters: [{ data: '' }],
    filterRender: {
      name: 'VxeInput',
    },
    align: 'center',
  },
  {
    title: 'itemCode',
    field: 'itemCode',
    filters: [{ data: '' }],
    filterRender: {
      name: 'VxeInput',
    },
    align: 'center',
  },
  {
    title: '未入库数量',
    field: 'shengYuNum',
    align: 'center',
  },
  {
    title: '交货日期',
    field: 'jiaoHuoDate',
    align: 'center',
  },
]


export const orderColumns: VxeGridPropTypes.Columns = [
  { type: 'checkbox', width: 40, align: 'center' },
  {
    title: '订单类别',
    field: 'orderType',
    showOverflow: 'title',
    // filters: [{ data: '' }],
    // filterRender: {
    //   name: 'VxeInput',
    // },
    width:80,
    align: 'center',
  },
  {
    title: '国外销售',
    field: 'guoWai',
    align: 'center',
    width:80,

  },
  {
    title: '客户编号',
    field: 'customerNo',
    align: 'center',
    width:80,
  },
  {
    title: '客户名称',
    field: 'customerName',
    align: 'center',
    width:80,
  },
  {
    title: '货币类型',
    field: 'currencyType',
    align: 'center',
    width:50,
  },
  {
    title: '客户产品编码',
    field: 'itemCode',
    filters: [{ data: '' }],
    filterRender: {
      name: 'VxeInput',
    },
    width:60,

    align: 'center',
  },
  {
    title: '销售数量',
    field: 'xiaoSouNum',
    width:50,
    align: 'center',
  },
  {
    title: '交货日期',
    field: 'jiaoHuoDate',
    align: 'center',
    width:73,

  },
  {
    title: '单价',
    field: 'unitPrice',
    align: 'center',
    width:50,

  },
  {
    title: '税率',
    field: 'suiLv',
    align: 'center',
    width:50,

  },
  {
    title: '客户交付需求日期',
    field: 'jiaoHuoDate',
    align: 'center',
    width:73,
  },
  {
    title: '客户承诺日期',
    field: 'jiaoHuoDate',
    align: 'center',
    width:73,
  },
  {
    title: '订单子预留8|合同号',
    field: 'hetongNo',
    align: 'center',
    width:150,
  },
  {
    title: '订单子预留9|出口国家',
    field: 'chukouGuoJia',
    align: 'center',
    width:83,
  },
  {
    title: '外箱装箱数',
    field: 'waiXianNum',
    align: 'center',
    width:50,
  },
]
